package com.myproject.map;

import com.myproject.entity.Player;

import java.util.Iterator;
import java.util.TreeMap;

public class TreeMapTest {

    public static void main(String[] args) {
        TreeMap<Player,String> treeMap = new TreeMap();
        treeMap.put(new Player("爱"),"1");
        treeMap.put(new Player("我"),"4");
        treeMap.put(new Player("中"),"3");
        treeMap.put(new Player("化"),"2");

        Iterator iterator = treeMap.keySet().iterator();
        while (iterator.hasNext()){
            Player key = (Player) iterator.next();
            System.out.println(key+"-->"+treeMap.get(key));
        }
    }
}
